package view;

import model.Model;
import control.Control;

public class View {
	
	private Control control;
	private Model model;
	private static View view=new View();
	
	
	private MainWindow mainWindow;
	private FrontCoverWindow frontCoverWindow=new FrontCoverWindow();
	
	private View(){	
	}
	
	public void init(){
		model=Model.getModel();
		control=Control.getControl();
		
		mainWindow=new MainWindow(model.getFileTree());
		mainWindow.setSongTitle(model.getCurrentSongTitle());
		mainWindow.setInterpret(model.getCurrentInterpret());
		mainWindow.setAlbum(model.getCurrentAlbum());
		mainWindow.setYear(model.getCurrentYear());
		mainWindow.setFrontCover(model.getCurrentFrontCover());
		mainWindow.repaint();
	}

	public static View getView(){
		return view;
	}
	
	//shows the FrontCover in original size (opens new window)
	public void showFrontCover(){
		frontCoverWindow.setFrontCover(model.getCurrentFrontCover());
		frontCoverWindow.setVisible(true);
	}
	
	
	
	public String getSongTitle(){
		return mainWindow.getSongTitle();
	}
	
	public String getInterpret(){
		return mainWindow.getInterpret();
	}
	
	public String getAlbum(){
		return mainWindow.getAlbum();
	}
	
	public String getYear(){
		return mainWindow.getYear();
	}
	
	//updates the file information
	public void update(){
		mainWindow.setSongTitle(model.getCurrentSongTitle());
		mainWindow.setInterpret(model.getCurrentInterpret());
		mainWindow.setAlbum(model.getCurrentAlbum());
		mainWindow.setYear(model.getCurrentYear());
		mainWindow.setFrontCover(model.getCurrentFrontCover());
		
	}
}
